package com.fenye.fenyefenye.controller;

import com.alibaba.fastjson.JSON;
import com.fenye.fenyefenye.dao.MonthDao;
import com.fenye.fenyefenye.service.UserService;
import com.fenye.fenyefenye.vo.User;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@Controller
@RequestMapping(value = "/month")
public class MonthController {

    @Autowired
    private MonthDao monthDao;

    @ResponseBody
    @RequestMapping("/count1")
    public Object demoasync(){
        /*
         模拟查询的结果：这种会映射成Map，一行一个Map，{field1:value1...}
          ———————————————————————————————————————————————————————————————
         |   field1   |  field2    |  field3   |   field4    |  field5  |
         |———————————————————————————————————————————————————————————————
         |   value1   |   value1   |   value1  |   value1    |  value1  |
         ————————————————————————————————————————————————————————————————
         */
        Map maps = monthDao.countMonth();
        /*
            模拟数据：这种会映射为数据，集合，指定集合中的类型
             ———————————————
             |   field1   |
             —————————————
             |   value1   |
             ——————————————
             |   value2   |
             ——————————————
             |   value3   |
             ——————————————
         */
        List<Integer> integers = monthDao.countMonth2();
        Map info = new HashMap();
        info.put("maps",maps);
        info.put("info",integers);
        return info;
    }


}